﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.Data.SqlClient;
using System.Resources;
using System.Configuration;
using System.Globalization;

namespace atm_qlda
{
    public partial class Login : Form
    {
        SqlConnection conn;
        CultureInfo culture;
        string error;
        string language;
        public Login()
        {
            InitializeComponent();

        }

        private void Login_Load(object sender, EventArgs e)
        {
            conn = new SqlConnection("conStr");
            SqlCommand cmd = new SqlCommand("select * from   ", conn);

            SqlDataAdapter da = new SqlDataAdapter();
            DataSet ds = new DataSet();
            da.Fill(ds, "nhanvien");
            
        }
       
        
        public void SetLanguage(string cultureName)
        {
            
            culture = CultureInfo.CreateSpecificCulture(cultureName);
            ResourceManager rm = new ResourceManager("atm_qlda.Lang.MyResource", typeof(Login).Assembly);
            lbAccount.Text = rm.GetString("acc", culture);
            lbPin.Text = rm.GetString("pin", culture);
            label1.Text = rm.GetString("bank", culture);
            lbClear.Text = rm.GetString("reset", culture);
            lbEnter.Text = rm.GetString("enter", culture);
            this.Text = rm.GetString("nameLogin", culture);
            error = rm.GetString("errorLogin",culture);
        }
        

        private void button3_Click(object sender, EventArgs e)
        {
             DataTable tb = ds.Tables[0];
            string user_name = "username '" + txtID.Text + "'";
            user_name+= "password ' " + txtPIN.Text + "'";
            DataRow[] rows = tbNhanVien.Select(user_name);
            if (rows.Length == 0)
            {
                MessageBox.Show(error);

            }
            else{
                //if()
                //{}
                //else
                //{
                 Withdraw rt =new Withdraw();
                 rt.Show();
                 if (this.language == "en-US")
                    {
                    rt.SetLanguage("en-US");
                    }
                    else
                 rt.SetLanguage("vi-VN");
                 this.Hide();
                //}
            }
        }
        public void setlag(string lag)
        {
           this.language = lag;
        }

     
        
   

        private void button1_Click()
        {
            lbClear.Text = this.language;
        }
    }
}